package com.lagou.util;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;

public final class JsonUtil {

    private static final Gson GSON = new Gson();

    private JsonUtil() {
        //no instance
    }

    public static <T> T fromJson(byte[] bytes, Class<T> clazz) {
        return JSON.parseObject(bytes, clazz);
    }

    public static byte[] toJson(Object object) {
        return JSON.toJSONBytes(object);
    }

}
